﻿using RGiesecke.DllExport;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace XboxOneDriver
{
    [StructLayout(LayoutKind.Sequential)]
    public struct XboxOneButtonData
    {
        [MarshalAs(UnmanagedType.U1)]
        public bool sync;
        [MarshalAs(UnmanagedType.U1)]
        public bool dummy1;     // Always 0.
        [MarshalAs(UnmanagedType.U1)]
        public bool start;  // Not entirely sure what these are
        [MarshalAs(UnmanagedType.U1)]
        public bool back;   // called on the new controller

        [MarshalAs(UnmanagedType.U1)]
        public bool a;
        [MarshalAs(UnmanagedType.U1)]
        public bool b;
        [MarshalAs(UnmanagedType.U1)]
        public bool x;
        [MarshalAs(UnmanagedType.U1)]
        public bool y;

        [MarshalAs(UnmanagedType.U1)]
        public bool dpad_up;
        [MarshalAs(UnmanagedType.U1)]
        public bool dpad_down;
        [MarshalAs(UnmanagedType.U1)]
        public bool dpad_left;
        [MarshalAs(UnmanagedType.U1)]
        public bool dpad_right;

        [MarshalAs(UnmanagedType.U1)]
        public bool bumper_left;
        [MarshalAs(UnmanagedType.U1)]
        public bool bumper_right;
        [MarshalAs(UnmanagedType.U1)]
        public bool stick_left_click;
        [MarshalAs(UnmanagedType.U1)]
        public bool stick_right_click;

        // Axes
        public ushort trigger_left;
        public ushort trigger_right;

        public short stick_left_x;
        public short stick_left_y;
        public short stick_right_x;
        public short stick_right_y;

        [MarshalAs(UnmanagedType.U1)]
        public bool centerButton;
    }
}
